<template>
  <div class="exam-detail">
    <el-card>
      <template #header>
        <div class="card-header">
          <span>考试详情</span>
        </div>
      </template>
      
      <el-descriptions :column="2" border>
        <el-descriptions-item label="学员姓名">{{ examInfo.studentName }}</el-descriptions-item>
        <el-descriptions-item label="联系电话">{{ examInfo.phone }}</el-descriptions-item>
        <el-descriptions-item label="考试科目">
          <el-tag>{{ examInfo.subject }}</el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="考试日期">{{ examInfo.examDate }}</el-descriptions-item>
        <el-descriptions-item label="考试时间">{{ examInfo.examTime }}</el-descriptions-item>
        <el-descriptions-item label="考试地点">{{ examInfo.examLocation }}</el-descriptions-item>
        <el-descriptions-item label="考试成绩">{{ examInfo.score }}</el-descriptions-item>
        <el-descriptions-item label="考试结果">
          <el-tag :type="examInfo.result === 'pass' ? 'success' : 'danger'">
            {{ examInfo.result === 'pass' ? '通过' : '未通过' }}
          </el-tag>
        </el-descriptions-item>
      </el-descriptions>
      
      <div class="remark">
        <h4>备注</h4>
        <p>{{ examInfo.remark }}</p>
      </div>
    </el-card>
  </div>
</template>

<script setup>
import { ref, onMounted } from 'vue'
import { useRoute } from 'vue-router'
import { ElMessage } from 'element-plus'

const route = useRoute()
const examInfo = ref({})

onMounted(() => {
  // 模拟从API获取考试详情
  examInfo.value = {
    studentName: '张三',
    phone: '13800138000',
    subject: '科目二',
    examDate: '2024-03-15',
    examTime: '09:00',
    examLocation: '市交通大队考场',
    score: 92,
    result: 'pass',
    remark: '考试表现良好，一次性通过。'
  }
})
</script>

<style scoped>
.exam-detail {
  padding: 20px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.remark {
  margin-top: 20px;
  padding: 10px;
  background-color: #f5f7fa;
  border-radius: 4px;
}
</style>